import Content from '@/sheep/layouts/content.vue';
import { request } from '@/sheep/request';

const route = {
  path: 'supply/info',
  name: 'shop.admin.info',
  component: Content,
  meta: {
    title: '信息',
  },
  children: [
    {
      path: 'basic',
      name: 'shop.admin.info.basic',
      component: () => import('./basic/index.vue'),
      meta: {
        title: '基本信息',
      },
    },
    {
      path: 'aptitude',
      name: 'shop.admin.info.aptitude',
      component: () => import('./aptitude/index.vue'),
      meta: {
        title: '行业资质/设置',
      },
    },
    {
      path: 'security',
      name: 'shop.admin.info.security',
      component: () => import('./security/index.vue'),
      meta: {
        title: '账号安全',
      },
    },
  ],
};

const api = {
  basic: {
    info: () =>
      request({
        url: `/admin/index/getAdminInfo`,
        method: 'GET',
      }),
  },
  security: {
    update: (data) =>
      request({
        url: `/admin/index/shopUpdate`,
        method: 'PUT',
        data,
      }),
  },
  aptitude: {
    // 保证金支付
    pay: () =>
      request({
        url: `/seller/admin/pay/prepay`,
        method: 'POST',
      }),
    // 基本信息
    store: (params) =>
      request({
        url: `/seller/admin/store/detail`,
        method: 'GET',
        params,
      }),
    // 修改信息
    update_store: (data) =>
      request({
        url: `/seller/admin/store/update`,
        method: 'POST',
        data,
      }),
    // 资质
    aptitude_info: (params) =>
      request({
        url: `/seller/admin/category`,
        method: 'GET',
        params,
      }),
    // 申请资质
    apply_aptitude: (data) =>
      request({
        url: `/seller/admin/category`,
        method: 'POST',
        data,
      }),
    // 重新申请资质
    reapply_aptitude: (id, data) =>
      request({
        url: `/seller/admin/category/${id}`,
        method: 'PUT',
        data,
      }),
    // 品牌
    brand_info: (params) =>
      request({
        url: `/seller/admin/brand`,
        method: 'GET',
        params,
      }),
    // 添加品牌
    add_brand: (data) =>
      request({
        url: `/seller/admin/brand`,
        method: 'POST',
        data,
      }),
    // 商品分类
    goods_type:(params)=>
      request({
        url: `/seller/admin/category/select`,
        method: 'GET',
        params
      }),
    reapply_brand:(id,data)=>
      request({
        url: `/seller/admin/brand/${id}`,
        method: 'PUT',
        data
      }),
    // 品牌详情
    brand_details:(id,params)=>
      request({
        url: `/seller/admin/brand/${id}`,
        method: 'GET',
        params
      }),
  },
};

export { route, api };
